From 88886b384aa79acd3e4eac72218a5dd0a1073047 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Wed, 30 Jul 2003 18:57:39 +0000 Subject: [PATCH] bitkeeper revision 1.385 (3f281523ZcjTKYBHYR4Oynisduu7hA) network.c: Network bug fix. --- .../arch/xeno/drivers/network/network.c | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/xenolinux-2.4.21-sparse/arch/xeno/drivers/network/network.c b/xenolinux-2.4.21-sparse/arch/xeno/drivers/network/network.c index 06d06e96f3..f1c5a7376a 100644 --- a/xenolinux-2.4.21-sparse/arch/xeno/drivers/network/network.c +++ b/xenolinux-2.4.21-sparse/arch/xeno/drivers/network/network.c @@ -216,8 +216,10 @@ static void network_alloc_rx_buffers(struct net_device *dev) struct sk_buff *skb; unsigned int end = RX_RING_ADD(np->rx_resp_cons, RX_MAX_ENTRIES); - for ( i = np->net_idx->rx_req_prod; i != end; i = RX_RING_INC(i) ) - { + if ( (i = np->net_idx->rx_req_prod) == end ) + return; + + do { skb = dev_alloc_skb(RX_BUF_SIZE); if ( skb == NULL ) break; skb->dev = dev; @@ -231,21 +233,21 @@ static void network_alloc_rx_buffers(struct net_device *dev) np->rx_bufs_to_notify++; } + while ( (i = RX_RING_INC(i)) != end ); - if ( np->rx_bufs_to_notify > (RX_MAX_ENTRIES/4) ) - { - /* - * We may have allocated buffers which have entries outstanding in the - * page update queue -- make sure we flush those first! - */ - flush_page_update_queue(); + /* + * We may have allocated buffers which have entries outstanding in the page + * update queue -- make sure we flush those first! + */ + flush_page_update_queue(); - np->net_idx->rx_req_prod = i; - - np->net_idx->rx_event = RX_RING_INC(np->rx_resp_cons); + np->net_idx->rx_req_prod = i; + np->net_idx->rx_event = RX_RING_INC(np->rx_resp_cons); + /* Batch Xen notifications. */ + if ( np->rx_bufs_to_notify > (RX_MAX_ENTRIES/4) ) + { HYPERVISOR_net_update(); - np->rx_bufs_to_notify = 0; } } -- 2.30.2